package hc.trip.airticket.input;

import hc.trip.airticket.httpclient.HttpRequestProxy;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.cookie.CookiePolicy;

public class GM {

	public static void main(String args[]) throws Exception{
		if (true) {
			String bb = "你";
			System.out.println(bb.getBytes().length);
			return ;
		} 
		Map postData   = new HashMap();
		Map header     = new HashMap();
		Map header1 = new HashMap();
		HttpRequestProxy proxy = new HttpRequestProxy();
		HttpClient client = proxy.getHttpClient();
		 
		postData.put("Login.x", "83");
		postData.put("Login.x", "12");
		postData.put("login-form-type", "pwd");
		postData.put("password", "win19850915");
		postData.put("username", "p7bckv");
		
		header.put("Host", "www.shanghaigm.com");
		// Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727)

		header.put("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13");
		header.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
		header.put("Connection", "keep-alive");
		header.put("Referer", "http://www.shanghaigm.com/pkmslogin.form");
		client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
		client.getParams().setParameter("http.protocol.single-cookie-header", true);
//		header.put("", "");
//		header.put("", "");
//		header.put("", "");
		proxy.doRequest("http://www.shanghaigm.com/pkmslogin.form", postData, header, "GBK");
		header1.put("Host", "www.shanghaigm.com");
		header1.put("Connection", "keep-alive");
		String cookieString = proxy.getCookieStr();
	   if (cookieString!=null&&cookieString.length()>0) {
		   header1.put("Cookie", proxy.getCookieStr());
	}
       
	   // String urlString = "http://www.shanghaigm.com/edealer_chs/start.swe?SWECmd=GetViewLayout&SWEView=SGM Vehicle Product Catalog View&SWEVI=&SWEVLC=1-1TF3M9_Siebel+eDealer_37|1297958427|1298002223_1_19237_000_L01 HTTP/1.1";
		String urlString = "http://www.shanghaigm.com/edealer_chs/start.swe?SWESetRowCnt=100&SWESetMarkup=XML&SWEDataOnly=True&SWEC=&SWECmd=GotoView&SWEView=SGM+Call+Plan+List+View&SWERF=1&SWEHo=www.shanghaigm.com&SWEBU=1&SWEApplet0=SGM+Call+Plan+List+Applet";
	    header1.put("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727)");
		String pp = proxy.doRequest(urlString, null, header1, "UTF-8");
	System.out.println(pp);
	}
	
}
